using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using JCTimes.DomainModel.Entity;

namespace JCTimes.EFRepository.Mapping
{
    public class FunctionRoleMap : EntityTypeConfiguration<FunctionRole>
    {
        public FunctionRoleMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.RoleID)
                .HasMaxLength(50);

            this.Property(t => t.UsersID)
                .HasMaxLength(50);

            this.Property(t => t.FunctionID)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("FunctionRole");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.RoleID).HasColumnName("RoleID");
            this.Property(t => t.UsersID).HasColumnName("UsersID");
            this.Property(t => t.FunctionID).HasColumnName("FunctionID");
            this.Property(t => t.CreateDate).HasColumnName("CreateDate");
        }
    }
}
